import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DownloadVO, DownloadForm, DownloadQuery } from '@/api/system/download/types';

/**
 * 查询下载管理列表
 * @param query
 * @returns {*}
 */

export const listDownload = (query?: DownloadQuery): AxiosPromise<DownloadVO[]> => {
  return request({
    url: '/system/download/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询下载管理详细
 * @param id
 */
export const getDownload = (id: string | number): AxiosPromise<DownloadVO> => {
  return request({
    url: '/system/download/' + id,
    method: 'get'
  });
};

/**
 * 新增下载管理
 * @param data
 */
export const addDownload = (data: DownloadForm) => {
  return request({
    url: '/system/download',
    method: 'post',
    data: data
  });
};

/**
 * 修改下载管理
 * @param data
 */
export const updateDownload = (data: DownloadForm) => {
  return request({
    url: '/system/download',
    method: 'put',
    data: data
  });
};

/**
 * 删除下载管理
 * @param id
 */
export const delDownload = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/download/' + id,
    method: 'delete'
  });
};
